# -*- coding:utf-8 -*-

from selenium import webdriver
from selenium.webdriver.support.ui import Select


class User:
    def __init__(self):
        pass

    def Login(self, driver, username=None, password=None):
        self.driver = driver

        if username==None and password==None:
            username = "gt"
            password = "111111"

        # driver.find_element_by_id("username").clear()
        driver.find_element_by_id("username").send_keys(username)

        # driver.find_element_by_id("userpwd").clear()
        driver.find_element_by_id("userpwd").send_keys(password)

        # driver.find_element_by_id("checkCode").clear()
        driver.find_element_by_id("checkCode").send_keys("ljdybdctest")

        driver.find_element_by_class_name("login-btn").click()

    def Logout(self, driver=None):
        if driver == None:
            driver = self.driver
        driver.find_element_by_xpath("/html/body/header/div[2]/div/ul/li[2]/a").click()
